package me.heizi.springboot.students.model


sealed class UserType(val id:Int, val chineseName:String) {
    object Administrator : UserType(id = 1, "管理员")
    object Teacher : UserType(id = 2, "老师")
    object Student : UserType(id = 3, "学生")
    class Dynamic(id: Int,chineseName: String):UserType(id,chineseName)
    companion object {
        fun found(id: Int,chineseName: String?=null) = when(id) {
            1-> Administrator
            2-> Teacher
            3-> Student
            else -> Dynamic(id,chineseName!!)
        }
        val all: Collection<UserType> get() = listOf(Administrator,Teacher,Student)
//        fun found(id: Int,chineseName: String?=null) = when(id) {
//            1-> Administrator
//            2-> Teacher
//            3-> Student
//            else -> Dynamic(id,chineseName!!)
//        }
    }
}